package smartcounters.androidclient.WebServices;

import java.util.LinkedList;

import android.os.Handler;
import android.os.Message;

public class MessageHandler extends Handler {
	private LinkedList<OnResultReceiver> m_ResultReceivers;
	
	public MessageHandler(){
		m_ResultReceivers = new LinkedList<OnResultReceiver>();
	}
	public void handleMessage(Message i_Msg){
		OnResultReceived(i_Msg);
	}
	
	public void RegisterResultReceiver(OnResultReceiver i_ResultReceiver){
		m_ResultReceivers.add(i_ResultReceiver);
	}
	
	protected void OnResultReceived(Message i_Msg){
		for (OnResultReceiver resultReceiver : m_ResultReceivers){
			resultReceiver.ReceiveResult(i_Msg);
		}
	}
}
